package com.burgeon.backend.SHOP.service.Impl;

import com.burgeon.backend.SHOP.service.ShopAppWeiService;

import com.burgeon.backend.SHOPBACKEND.entity.vip.Employee;
import com.burgeon.backend.SHOPBACKEND.rest.weixin.findEmployeeById;
import com.burgeon.backend.entity.Info;
import com.burgeon.backend.mappers.AccountMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ShopAppWeiServiceImpl implements ShopAppWeiService {
    @Autowired
    private AccountMapper accountMapper;

    public Employee findEmpById(String daoId, String token){
        Info info = GetInfo(token);
        findEmployeeById g = new findEmployeeById(info.getUrl(), info.getAccount(), info.getPassword());
        try {
            return g.getData(daoId);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

    private Info GetInfo(String token) {
        return accountMapper.GetTokenData(token);
    }
}
